package com.csun.cmny.provider.controller.admin;

import com.csun.cmny.base.dto.LoginAuthDto;
import com.csun.cmny.core.support.BaseController;
import com.csun.cmny.provider.model.vo.GroupInforVo;
import com.csun.cmny.provider.resolver.CmnyMessageSource;
import com.csun.cmny.provider.service.UacGroupService;
import com.csun.cmny.util.wrapper.WrapMapper;
import com.csun.cmny.util.wrapper.Wrapper;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import java.util.List;

@RestController
@RequestMapping("/group")
public class UacGroupController extends BaseController {

    @Resource
    private UacGroupService uacGroupServiceImpl;

    @Resource
    private CmnyMessageSource cmnyMessageSource;

    /*
    * 集团化查询下属养老院
    * */
    @PostMapping("/getAllGroup")
    public Wrapper getAllGroup(){
        LoginAuthDto loginAuthDto = getLoginAuthDto();
        List<GroupInforVo> groupInforVos = uacGroupServiceImpl.getAllGroup(loginAuthDto.getGroupId());
        return WrapMapper.wrap(Wrapper.SUCCESS_CODE, cmnyMessageSource
                .getMessage("operation.success", null), groupInforVos);
    }

}
